<form action="{:sysuri('add')}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="AboutClass">
    <div class="layui-card-body padding-left-40 layui-col-space10">

        <div class="layui-col-md12">

            <div class="layui-input-inline">

                {foreach $task_arr as $item}

                <input type="checkbox" lay-skin="tag" name="{$item.id}" value="{$item.id}" title="{$item.title}" {if $item.is_check} checked {/if} lay-filter="demo-checkbox-filter">

                {/foreach}
            </div>
        </div>

    </div>

</form>
<script>
    var class_id = {$class_id};
    // 指向所有 select 组件的选择事件
    layui.form.on('checkbox(demo-checkbox-filter)', function(data){
        console.log(data.elem.value);
        let elem = data.elem; // 获得 checkbox 原始 DOM 对象
        let checked = elem.checked; // 获得 checkbox 选中状态
        let value = elem.value; // 获得 checkbox 值

        $.ajax({
            type : 'post',
            url  : "{:sysuri('change')}",
            data : {task_id:value, status:checked ? 1 : 0,class_id:class_id},
            success:function (res) {

            }
        })
        layer.msg('成功');
    });
</script>